package cn.edu.ncut.cs.springboot.springbootmybatisplus.service.impl;

import cn.edu.ncut.cs.springboot.springbootmybatisplus.entity.Score;
import cn.edu.ncut.cs.springboot.springbootmybatisplus.mapper.ScoreMapper;
import cn.edu.ncut.cs.springboot.springbootmybatisplus.service.IScoreService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class ScoreServiceImpl extends ServiceImpl<ScoreMapper, Score> implements IScoreService {

    @Autowired
    private ScoreMapper scoreMapper;
    @Override
    public boolean update(Score score) {
        int rowsAffected = scoreMapper.updateScoreBySnoAndCno(score.getSno(), score.getCno(), score.getScore());
        // 根据受影响的行数返回是否更新成功
        return rowsAffected > 0;
    }
}
